home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / asm32v20.zip / GRAPHICS.DOC < prev    next >
Text File  |  1995-01-27  |  63KB  |  1,811 lines

  1.  
  2. ****************************** GRAPHICS *************************************
  3.  
  4. ASM32 Graphics (C) Copyright 1993 Douglas Herr
  5. All rights reserved
  6.  
  7. ASM32 recognizes and automatically supports several graphics modes,
  8. including several which are not recognized by IBM's BIOS.  You should
  9. assume that all ASM32 graphics subroutines write directly to the video
  10. hardware.
  11.  
  12. Locations on Graphics screens are defined by coordinate pairs such as (x,y).
  13. X-coordinates are the horizontal dimensions of the screen, and Y-coordinates
  14. are the vertical coordinates.  X = 0 is the at the left edge of the screen,
  15. and X = 719 is the right edge of a Hercules screen, while Y = 0 is the top
  16. edge of the screen and Y = 347 is the bottom (Hercules).  Thus, the
  17. coordinate specified by (719,0) is the extreme upper right corner of a
  18. Hercules screen.
  19.  
  20. Graphics subroutines as powerful and flexible as ASM32's can be quite
  21. large.  If you have licenced ASM32 source code, you can use several
  22. pre-defined conditional assembly directives to eliminate code from
  23. ASM32 object files if you do not want or need to support all graphics
  24. modes:
  25.  
  26.         NOHERC      eliminates all Hercules and InColor code
  27.         NOINCOLOR   eliminates code for the InColor card
  28.                (InColor works with Hercules monochrome code in 2 colors)
  29.         NO256       eliminates code for the three 256-color modes
  30.         NOCGA       eliminates code for CGA graphics modes
  31.         EVGA        assembles only instructions for the EGA/VGA-type
  32.                     16-color modes.
  33.  
  34. If you want to support only 16-color EGA/VGA-type modes, you may also use
  35. the EVGA32.LIB library to eliminate much of the code and data required
  36. for monochrome, InColor, CGA and 256-color modes.  EVGA32.LIB can eliminate
  37. several thousand bytes from your executable files.
  38.  
  39. Example:
  40.  
  41. WL32 mycode[.obj],,,EVGA32+ASM32
  42.  
  43. When using the EVGA32 library, EVGA32 must appear before ASM32 on the
  44. command line so that WL32 uses the subroutines in EVGA32.LIB instead of
  45. the general subroutines in ASM32.
  46.  
  47. EVGA32.LIB is provided with standard ASM32 registration.
  48.  
  49.  
  50. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  51.  
  52. Graphics modes and pages supported are:
  53.  
  54. Mode           Maximum x   Maximum y   Colors  Pages (1)  Equipment
  55.                 ("xmax")    ("ymax")
  56.  
  57. HGraph           719          347       2         0, 1    HGC, HGC+ (2)
  58. HGraph           719          347      16         0, 1    InColor  (2)
  59. 04h, 05h         319          199       4         0       CGA, EGA, MCGA, VGA
  60. 06h              639          199       2         0       CGA, EGA, MCGA, VGA
  61. 0Dh              319          199       16        0 - 7   EGA, VGA  (3)
  62. 0Eh              639          199       16        0 - 3   EGA, VGA  (3)
  63. 0Fh              639          349       4         0       EGA, VGA  (4)
  64. 10h              639          349       16        0, 1    EGA, VGA  (3,5)
  65. 11h              639          479       2         0       MCGA, VGA
  66. 12h              639          479       16        0       VGA
  67. 13h              319          199       256       0       MCGA, VGA
  68. 40h              639          399       2         0       ATT 6300
  69. 6Ah              799          599       16        0       VESA  (6)
  70. XMode16      up to 799     up to 599    16        0       Super EGA/VGA
  71. VGA13X      319 or 359    199 to 479    256       (7)     VGA
  72. SVGA16      799 or 1023   599 or 767    16        0       Super VGA (8)
  73. SVGA256     639 to 1023   399 to 767    256       0       Super VGA (8)
  74.  
  75. (1) page numbering begins with page 0.  Several modes have sufficient
  76.     memory available for additional page(s).
  77. (2) page 1 available after calling Use64k
  78. (3) EGA pages assumes 256k EGA memory
  79. (4) monochrome monitor only
  80. (5) EGA with 128k or more memory
  81. (6) VESA6A is supported by many Super VGA cards with multi-frequency
  82.     monitors
  83. (7) VGA13X pages available range from 0 to 3.  See VGA13X in MODE.DOC.
  84. (8) requires VGAKIT-compatible Super VGA and multi-frequency monitor.  See
  85.     WhichVGA in SYSTEM.DOC and SVGA16 and SVGA256 in MODE.DOC.
  86.  
  87. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  88.  
  89. BEZIER:        draw a Bezier curve on the screen
  90. Source:        bezier.asm (drawline.asm)
  91.  
  92. 80x87 or emulator required
  93.  
  94. Call with:     EBX pointing to curve coordinate data
  95.                ECX = number of points on curve (ECX > 0)
  96.                 a larger number of points on the curve will result in
  97.                 slower operation and a smoother curve.  In many cases
  98.                 ECX > 50 will not improve the appearance of the curve.
  99.  
  100.                 Four coordinates are required: two curve endpoints and
  101.                 two control points.  The curve endpoints (x0, y0) and
  102.                 (x3, y3) are similar to DrawLine's coordinates; if you
  103.                 call bezier with ECX = 1, you will see only a straight
  104.                 line between the endpoints.  The "control points" act
  105.                 like magnets, pulling the curve away from a straight line.
  106.                 At each endpoint, the curve is tangent to a line drawn
  107.                 between the endpoint and the adjacent control point
  108.                 ("adjacent" control point meaning adjacent in the data
  109.                 structure).
  110.  
  111. Returns:       nothing
  112. Uses:          all 80x87 registers
  113. Supports:      all ASM32 graphics modes; drawmode 0 not recommended
  114. Example:
  115.  
  116. include codeseg.inc
  117.  
  118. extrn   bezier:near
  119.  
  120. ; data
  121. extrn   drawmode:byte
  122. bz      dw 50,50            ; first endpoint:       (x0, y0)
  123.         dw 100,0            ; first control point:  (x1, y1)
  124.         dw 200,0            ; second control point: (x2, y2)
  125.         dw 250,175          ; second endpoint:      (x3, y3)
  126.                             ; note that both control points in this
  127.                             ; example pull the curve toward the top of the
  128.                             ; screen
  129.  
  130. ; code
  131. ; program fragment assumes 80x87 is installed
  132. ; and that the screen is in graphics mode
  133.         .
  134.         .
  135.         mov     drawmode,1  ; use foreground color
  136.         lea     ebx,bz      ; point to bezier curve data
  137.         mov     ecx,100     ; should be adequate
  138.         call    bezier
  139.  
  140.  
  141.  
  142. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  143.  
  144. BITBLOCKBYTES: calculate bytes required to save a bit block
  145. Source:        bbbytes.asm ($graph.asm)
  146.  
  147. Call with:     EBX pointing to x- and y-coordinate data (see example)
  148. Returns:       EAX = bytes required to save the bit block
  149. Uses:          EAX, flags
  150. Supports:      all ASM32 graphics modes; call BitBlockBytes while
  151.                the system is in the mode you intend to use.  Otherwise,
  152.                an incorrect byte size may be returned, leading to either
  153.                wasted memory or memory allocation errors.
  154. Example:
  155.  
  156. include codeseg.inc
  157.  
  158. extrn   bitblockbytes:near
  159.  
  160. ; data
  161. x0      dw 100,43         ; first corner at (100,43)
  162. x1      dw 175,143        ; second corner at (175,143)
  163.  
  164. ; code
  165.         .
  166.         .
  167.         .
  168.         lea    ebx,x0          ; EBX points to bit block corner data
  169.         call   bitblockbytes   ; returns EAX = byte size of buffer required
  170.  
  171.  
  172.  
  173. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  174.  
  175. BITPLANEBYTES: calculate bytes to save one plane of a bit block
  176.                alternate entry to BitBlockBytes; calculates bytes
  177.                required to save one plane of multi-plane modes
  178. Source:        bbbytes.asm ($graph.asm)
  179. Call with:     EBX pointing to x- and y-coordinate data
  180. Returns:       EAX = bytes required to save the bit plane
  181. Uses:          EAX, flags
  182. Supports:      all ASM32 graphics modes; call BitPlaneBytes while
  183.                the system is in the mode you intend to use.  If the
  184.                system is is not in a multi-plane mode, BitPlaneBytes
  185.                will give you the same results as BitBlockBytes.
  186.                Graphics modes with multiple planes are mode 0Fh (2 planes)
  187.                and all 16-color modes (4 planes).
  188. Example:
  189.  
  190. include codeseg.inc
  191.  
  192. extrn   bitplanebytes:near
  193.  
  194. ; data
  195. x0      dw 100,43         ; first corner at (100,43)
  196. x1      dw 175,143        ; second corner at (175,143)
  197.  
  198. ; code
  199.         .
  200.         .
  201.         .
  202.         lea    ebx,x0          ; EBX points to bit block corner data
  203.         call   bitplanebytes   ; returns EAX = byte size of buffer required
  204.  
  205.  
  206. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  207.  
  208. BUFFERDIM:     change logical buffer dimensions
  209.                does not change number of pixels displayed on screen;
  210.                used with ScreenOrigin.
  211. Source:        buffdim.asm ($graph.asm)
  212.  
  213. Call with:     EBX pointing to new buffer dimensions
  214.                Note that the logical buffer dimensions should be
  215.                greater than the dimensions displayed on the screen
  216.                The logical buffer dimensions must not create a plane size
  217.                greater than 64k; a logical pixel width of 800 + logical height
  218.                of 600 works out to 60,000 bytes per plane.
  219.  
  220.                If anything is displayed on the screen before changing
  221.                logical dimensions, it will be unreadable after calling
  222.                BufferDim if your logical x-dimension is not the same as
  223.                the screen's physical x-width.
  224.  
  225.                BufferDim does no error checking; you must determine if
  226.                the computer has an EGA or VGA (see GetCRT in SYSTEM.DOC)
  227.                and you must verify that the logical dimensions are greater
  228.                than the screen dimensions.
  229.  
  230.                Using BufferDim disables ASM32's multiple graphics pages
  231.                capabilities.
  232.  
  233. Returns:       nothing
  234. Uses:          nothing; all registers and flags are saved
  235. Supports:      EGA/VGA-type 16-color graphics modes
  236. Example:       see next page
  237.  
  238.  
  239.  
  240. (BufferDim example)
  241.  
  242. ; The computer has a 256k EGA card & EGA-only monitor 
  243. ; and I want to display an image that is 800 pixels wide
  244. ; and 600 pixels high.
  245. ; I'll use EGA mode 10h, switch to logical dimensions of 800x600,
  246. ; put the image in the video buffer & use ScreenOrigin to view
  247. ; various parts of the image
  248.  
  249. include codeseg.inc
  250.  
  251. public  mysub
  252. extrn   bufferdim:near, screenorigin:near
  253. extrn   loadpcx:near
  254.  
  255. include model.inc
  256.  
  257. include dataseg.inc
  258.  
  259. dim     dw 800,600              ; I want 800 logical x
  260.                                 ;  & 600 logical y
  261. xy      dw 0,0                  ; screen origin always starts at (0,0)
  262. fname   db '800x600.pcx',0      ; a .PCX file with an 800 x 600 image
  263. @curseg ends
  264.  
  265. include codeseg.inc
  266.  
  267. mysub   proc    near
  268. ; set up 640x350 16-color mode
  269.         mov    ax,10h           ; use BIOS to set mode
  270.         int    10h
  271.         lea    ebx,dim          ; point to logical buffer dimensions
  272.         call   bufferdim        ; set up 800x600 logical dimensions
  273.                                 ; NOTE: only one page available
  274.  
  275. ; program loads image to video buffer
  276.         lea    edx,fname        ; point to filename
  277.         call   loadpcx          ; get image
  278.  
  279. ; default screen origin: (0,0) of buffer is at (0,0) of screen
  280. ; change portion of buffer displayed to logical (100,100)
  281. ; at (0,0) of screen
  282.         lea    ebx,xy
  283.         mov    word ptr [ebx],100
  284.         mov    word ptr 2[ebx],100
  285.         call   screenorigin
  286.  
  287.  
  288. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  289.  
  290. CIRCLEASPECT:  modifies aspect ratio of circle
  291. Source:        drawcirc.asm ($graph.asm)
  292.  
  293. Call with:     AH = numerator of aspect ratio
  294.                AL = denominator of aspect ratio
  295.                AH <> 0, AL <> 0
  296.  
  297.                CircleAspect is used with DrawCircle to draw an ellipse.
  298.                An aspect ratio less than one makes a flat ellipse and an
  299.                aspect ratio greater than one makes a tall ellipse.
  300.  
  301. Returns:       nothing
  302. Uses:          nothing; all registers and flags are saved
  303. Supports:      all ASM32 graphics modes
  304. Example:       see DrawCircle
  305.  
  306.  
  307.  
  308. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  309.  
  310. DEFGMODE:      restore ASM32's internal flags to use system graphics mode
  311.                (see ForceGMode)
  312. Source:        defgmode.asm
  313.  
  314. Call with:     no parameters
  315. Returns:       nothing
  316. Uses:          nothing
  317. Supports:      all ASM32 graphics modes
  318. Example:       see ForceGMode
  319.  
  320.  
  321.  
  322. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  323.  
  324. DRAWCIRCLE:    draw a circle
  325. Source:        drawcirc.asm ($graph.asm, $putdot.asm)
  326.  
  327. Call with:     EBX pointing to circle center coordinates and x-radius
  328.                Drawmodes supported are:
  329.                 4 = AND the foreground color with the screen
  330.                 3 = OR the foreground color with the screen
  331.                 1, 2 = use foreground color
  332.                 0 = XOR circle with existing screen
  333.                -1, -2 = use background color
  334.                -3 = OR the background color with the screen
  335.                -4 = AND the background color with the screen
  336.                See DrawMode for more information
  337.                See also CircleAspect
  338. Returns:       nothing
  339. Uses:          nothing
  340. Supports:      all ASM32 graphics modes
  341. Example:
  342.  
  343. include codeseg.inc
  344.  
  345. extrn   drawcircle:near, circleaspect:near
  346.  
  347. ; data
  348. xcenter dw 100              ; DrawCircle data must be words
  349. ycenter dw 100              ; the circle is centered at (100,100)
  350. xradius dw 50               ; x-dimension radius in pixels (>0)
  351.  
  352. ; code
  353.         .
  354.         .
  355.         .
  356.         mov   ah,5
  357.         mov   al,1          ; a tall ellipse
  358.         call  circleaspect
  359.  
  360.         lea   ebx,xcenter   ; EBX points to circle data
  361.         call  drawcircle    ; draw the circle
  362.  
  363.  
  364. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  365.  
  366. DRAWBOX:       draw a rectangle on a graphics screen
  367. Source:        drawbox.asm ($graph.asm, $vert.asm, $horiz.asm, several others)
  368.  
  369. Call with:     EBX pointing to box corner data
  370.                Drawmodes supported are:
  371.                 4 = AND the foreground color with the screen; color modes
  372.                 3 = OR the foreground color with the screen
  373.                 1, 2 = use foreground color: all modes
  374.                 0 = XOR foreground color with existing pixels
  375.                -1, -2 = use background color: all modes
  376.                -3 = OR the background color with the screen
  377.                -4 = AND the background color with the screen; color modes
  378.                See DrawMode for more information; see also LinePattern
  379. Returns:       nothing
  380. Uses:          nothing
  381. Supports:      all ASM32 graphics modes
  382. Example:
  383.  
  384. include codeseg.inc
  385.  
  386. extrn   drawbox:near
  387.  
  388. ; data
  389. x0      dw 25,10            ; first corner at (25,10); data is word size
  390. x1      dw 301,97           ; opposite corner at (301,97)
  391.  
  392. ; code
  393.         .
  394.         .
  395.         lea   ebx,x0         ; EBX points to box corner data
  396.         call  drawbox
  397.  
  398.  
  399. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  400.  
  401. DRAWLINE:      draw a line on a graphics screen
  402. Source:        drawline.asm ($graph.asm, $vert.asm, $horiz.asm,
  403.                              $loslope.asm, $hislope.asm, many others)
  404.  
  405. Call with:     EBX pointing to line endpoint data
  406.                Drawmodes supported are:
  407.                 4 = AND the foreground color with the screen; color modes
  408.                 3 = OR the foreground color with the screen
  409.                 1, 2 = use foreground color: all modes
  410.                 0 = XOR foreground color with existing pixels
  411.                -1, -2 = use background color: all modes
  412.                -3 = OR the background color with the screen
  413.                -4 = AND the background color with the screen; color modes
  414.                See DrawMode for more information; see also LinePattern
  415. Returns:       nothing
  416. Uses:          nothing
  417. Supports:      all ASM32 graphics modes
  418. Example:
  419.  
  420. include codeseg.inc
  421.  
  422. extrn   drawline:near
  423.  
  424. ; data
  425. x0      dw 25,10            ; first endpoint at (25,10); data is word size
  426. x1      dw 301,97           ; other end of line at (301,97)
  427.  
  428. ; code
  429.         .
  430.         .
  431.         lea   ebx,x0         ; [EBX] points to line coordinate data
  432.         call  drawline
  433.  
  434.  
  435. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  436.  
  437. DRAWMODE:      control ASM32 graphics drawing mode
  438. Source:        $graph.asm
  439.  
  440.                DrawMode is a public byte used to control the operation
  441.                of many ASM32 subroutines.  ASM32's default drawmode is 1.
  442.  
  443.                Typically, drawmodes have the following effects:
  444.                 2 = use foreground color only; text is printed without
  445.                     background, foreground only of line patterns or
  446.                     fill patterns is used
  447.                 1 = use foreground and background; text is printed with
  448.                     background, line patterns and fill patterns update
  449.                     both foreground and background
  450.                 0 = foreground color is XORed with the existing screen
  451.                     (not supported in 256-color or CGA 4-color modes)
  452.                -1 = characters or fill pattern drawn with foreground
  453.                     and background reversed
  454.                -2 = character or line drawn with background color only
  455.  
  456. Supports:      all ASM32 graphics modes
  457. Example:
  458.  
  459. include codeseg.inc
  460.  
  461. ; data
  462. extrn   drawmode:byte
  463.  
  464. ; code
  465.         .
  466.         .
  467.         mov     drawmode,2      ; print text with foreground color only
  468.  
  469.  
  470. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  471.  
  472. FILLAREA:      fills an irregular area on a graphics screen
  473. Source:        fillarea.asm ($graph.asm, $horiz.asm, $getdot.asm,
  474.                              several others)
  475.  
  476. Call with:     EBX pointing to seed pixel coordinates
  477.  
  478.                Fills many irregularly-shaped areas with color and/or
  479.                pattern, beginning at (x,y).  FillArea may not work
  480.                properly with regions which have concave boundaries
  481.                crossing horizontal lines.  The area's boundary is
  482.                defined by a solid line of non-zero pixels.
  483.                DrawModes supported are:
  484.                 2 = fill with foreground color only (if fill pattern
  485.                     has been defined): 16-color modes
  486.                 1 = fill with foreground (and background, if fillpattern
  487.                     defined): all modes
  488.                See also FillPattern.
  489. Returns:       nothing
  490. Uses:          nothing
  491. Supports:      all ASM32 graphics modes
  492. Example:
  493.  
  494. include codeseg.inc
  495.  
  496. extrn   fillarea:near
  497.  
  498. ; data
  499. x       dw 10,15         ; start fill operation at x=10, y=15
  500.  
  501. ; code
  502.         .
  503.         .
  504.         lea    ebx,x
  505.         call   fillarea
  506.  
  507.  
  508. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  509.  
  510. FILLBOX:       draw a filled rectangle on a graphics screen
  511. Source:        fillbox.asm ($graph.asm, $horiz.asm, several others)
  512.  
  513. Call with:     EBX pointing to box corner data
  514.                Drawmodes supported are:
  515.                 4 = AND the box with the pre-existing screen
  516.                 3 = OR the foreground color with the screen
  517.                 1, 2 = use foreground color
  518.                 0 = XOR foreground color with existing pixels
  519.                -1, -2 = use background color
  520.                -3 = OR the background color with the screen
  521.                -4 = AND the background color with pre-existing screen
  522.                See DrawMode for more information; also see FillPattern.
  523. Returns:       nothing
  524. Uses:          nothing
  525. Supports:      all ASM32 graphics modes
  526. Example:
  527.  
  528. include codeseg.inc
  529.  
  530. extrn   fillbox:near
  531.  
  532. ; data
  533. x0      dw 25,10            ; first corner at (25,10); data is word size
  534. x1      dw 301,97           ; opposite corner at (301,97)
  535.  
  536. ; code
  537.         .
  538.         .
  539.         lea   ebx,x0         ; [EBX] points to box corner data
  540.         call  fillbox
  541.  
  542.  
  543. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  544.  
  545. FILLPATTERN:   define an optional pattern for FillArea & FillBox
  546. Source:        fpattern.asm
  547.  
  548. Call with:     EBX pointing to ASCIIZ pattern string.
  549.                Up to 8 characters in the string will be used.
  550.                The pattern must be re-defined before each call to a line
  551.                drawing subroutine (FillArea, FillBox).
  552. Returns:       nothing
  553. Uses:          nothing
  554. Supports:      all ASM32 graphics modes except 256-color modes
  555. Example:
  556.  
  557. include codeseg.inc
  558.  
  559. extrn   fillbox:near
  560. extrn   fillpattern:near
  561.  
  562. ; data
  563. x0      dw 25,10            ; first corner at (25,10); data is word size
  564. x1      dw 301,97           ; opposite corner at (301,97)
  565. pattern db 8 dup(10101010b),0
  566.  
  567. ; code
  568.         .
  569.         .
  570.         lea   ebx,pattern   ; [EBX] points to pattern string
  571.         call  fillpattern   ; define the pattern
  572.         sub   ebx,8         ; [EBX] points to box corner data
  573.         call  fillbox       ; draw a patterned box
  574.  
  575.  
  576. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  577.  
  578. FORCEGMODE:    force ASM32 to use one particular graphics mode
  579.                this is handy for two-monitor systems
  580. Source:        defgmode.asm
  581.  
  582. Call with:     AL = graphics mode to use
  583.                forcegmode does not change the actual screen mode; what
  584.                it does is to force ASM32's central graphics control
  585.                to ignore the system mode.  Call defgmode to restore
  586.                ASM32's internal flags to the default state.
  587. Returns:       nothing
  588. Uses:          nothing
  589. Supports:      all ASM32 graphics modes (256-color modes not tested)
  590. Example:
  591.  
  592. include codeseg.inc
  593.  
  594. extrn   modecolor:near, modemono:near
  595. extrn   forcegmode:near, gcolor:near, defgmode:near
  596.  
  597. ; data
  598. gtext   db 'Graphics mode',0
  599. gpos    dd 0                   ; 2 words of zeros to position text
  600. ttext   db 'Text mode',0
  601.  
  602. ; code
  603.         .
  604. ; I want text on the monochrome screen and 16-color graphics on the EGA
  605.         call   modecolor       ; switch to color monitor
  606.         mov    v86r_ax,10h     ; set up graphics mode
  607.         mov    al,10h
  608.         int    30h
  609.         mov    al,10h          ; tell ASM32 to use mode 10h
  610.                                ; use AL = 13h for VGA 256-color modes
  611.                                ; use AL = 8 for Hercules (including InColor)
  612.         call   forcegmode      ; best to do this after the mode change
  613.         call   modemono        ; switch back to the monochrome monitor
  614.         mov    ax,010Ch        ; blue background, red foreground
  615.         call   gcolor
  616.         lea    esi,gtext       ; point to graphics message
  617.         lea    edx,gpos        ; positioned at upper left corner
  618.         call   gprint          ; prints on EGA in graphics mode
  619.  
  620.         lea    esi,ttext       ; point to text message
  621.         xor    dx,dx           ; upper left corner of text screen
  622.         mov    ah,7            ; normal color
  623.         call   tprint          ; display message on monochrome monitor
  624.         .
  625.         .
  626. ; sometime later, all done with this setup
  627.         call   defgmode        ; clear ASM32's internal graphics flags
  628.  
  629.  
  630. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  631.  
  632. GBASEADDRESS:  change ASM32 graphics base address
  633. Source:        gbaseadr.asm ($graph.asm)
  634.  
  635. Call with:     EAX = base address for alternate graphics BUFFER
  636.                if EAX = 0, default base segment is restored
  637.                GBaseSeg may be used to create and update off-screen graph
  638.                images, thus simulating multiple screen pages.
  639. Returns:       nothing
  640. Uses:          nothing
  641. Supports:      mode 04h, 05h, HGraph (monochrome only), 40h, 11h, 13h
  642.  
  643.                buffer size requirements:
  644.  
  645.                 mode 04h, 05h    16384 bytes
  646.                 HGraph, 40h      32768 bytes
  647.                 mode 11h         38400 bytes
  648.                 mode 13h         64000 bytes
  649.  
  650.                 You must call GBaseAddress AFTER switching the system to
  651.                 graphics mode, or it will not work; you must also call
  652.                 GBaseAddress with EAX = 0 before changing from one graphics
  653.                 mode to another, or the default base address may get messed
  654.                 up.
  655. Example:
  656.  
  657. public myprog
  658.  
  659. include codeseg.inc
  660.  
  661. extrn  gbaseaddress:near, drawbox:near
  662.  
  663. ; data
  664. boxdata dw 0,0,319,199
  665.  
  666. screen1 db 64000 dup (0)     ; second screen for mode 13h
  667.  
  668. ; code
  669. myprog proc
  670. ; mode 13h, 320x200x256 colors
  671.        mov     v86r_ax,13h
  672.        mov     al,10h
  673.        int     30h
  674.  
  675. ; use alternate buffer
  676.        lea     eax,screen1
  677.        call    gbaseaddress
  678.        lea     ebx,linedata
  679.        call    drawbox
  680.  
  681. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  682.  
  683. GCENTER:       centers a string on a graphics screen
  684. Source:        gcenter.asm (gprint.asm, $graph.asm, strlen.asm, f8x14.asm)
  685.  
  686. GCENTERX:      centers a double-width string on a graphics screen
  687. Source:        gcenterx.asm (gprintx.asm, $graph.asm, strlen.asm, f8x14.asm)
  688.  
  689. Call with:     ESI pointing to the string to print
  690.                EDX pointing to x- and y-coordinates
  691.                the x-coordinate is a placeholder; GCenter calculates the
  692.                correct x value before calling GPrint.
  693.  
  694.                Colors, drawmodes and character sizes are the same as
  695.                for GPrint or GPrintX.
  696. Returns:       x = calculated x-coordinate
  697. Uses:          nothing; all registers and flags are saved.
  698. Supports:      all ASM32 graphics modes
  699. Example:
  700.  
  701. include codeseg.inc
  702.  
  703. extrn   gcenter:near
  704.  
  705. ; data
  706. x       dw ?
  707. y       dw 2               ; print graph title 2 pixels down from the top
  708. title   db 'Graph title',0
  709.  
  710. ; code
  711.         .
  712.         .
  713.         lea    esi,title    ; ESI points to string
  714.         lea    edx,x        ; point to coordinates
  715.         call   gcenter      ; print the string, centered horizontally
  716.  
  717.  
  718. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  719.  
  720. GCLEAR:        clears the active portion of a graphics screen
  721.                uses background color
  722. Source:        gclear.asm ($graph.asm, $horiz.asm, others)
  723.  
  724. Call with:     no parameters
  725. Returns:       nothing
  726. Uses:          nothing
  727. Supports:      all ASM32 graphics modes
  728. Example:
  729.  
  730. include codeseg.inc
  731.  
  732. extrn   gclear:near
  733.  
  734. ; code
  735.         .
  736.         .
  737.         .
  738.         call  gclear
  739.  
  740. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  741.  
  742. GCOLOR:        update color used by ASM32 graphics
  743. Source:        gcolor.asm ($graph.asm)
  744.  
  745. Call with:     AL = foreground color
  746.                AH = background color
  747.  
  748.                for 4-color modes, colors may be 0-3
  749.                for 16-color modes, colors may be 0-15
  750.                for 256-color modes, colors may be 0-255
  751.  
  752. Returns:       nothing
  753. Uses:          nothing
  754. Supports:      all color graphics modes and mode 0Fh
  755.                GColor is ignored by 2-color modes
  756. Example:
  757.  
  758. include codeseg.inc
  759.  
  760. extrn   gcolor:near
  761.  
  762. ; code
  763.         .
  764.         .
  765.         .
  766.         mov   ah,bcolor      ; background color
  767.         mov   al,fcolor      ; foreground color
  768.         call  gcolor
  769.  
  770.  
  771. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  772.  
  773. GCOPY:         copies one page of graphics memory to another
  774. Source:        gcopy.asm ($graph.asm)
  775.  
  776. Call with:     BH = frompage
  777.                BL = topage
  778. Returns:       CF = error flag
  779.                 if CF = 0, no error
  780.                 if CF = 1, bad page number or frompage = topage
  781. Uses:          CF
  782. Supports:      Hercules and InColor (with Use64k)
  783.                EGA/VGA modes 0Dh, 0Eh, 0Fh, 10h
  784.                VGA13X [0,1,2]
  785. Example:
  786.  
  787. include codeseg.inc
  788.  
  789. extrn   gcopy:near
  790.  
  791. ; code
  792.         .
  793.         .
  794.         .
  795.         mov   bx,0001h       ; copy from page 0 to page 1
  796.         call  gcopy
  797.         jc    bad_page       ; uh oh, pages not supported
  798.  
  799.  
  800. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  801.  
  802. GCURSOR:       simulate text-mode cursor on graphics screen
  803. GUCURSOR:      simulate underscore cursor on graphics screen
  804. Source:        gcursor.asm ($graph.asm)
  805.  
  806. Call with:     EDX pointing to x- and y-coordinate word data
  807.                x and y are the coordinates of the UPPER LEFT corner of
  808.                a character block.  Note that text characters are
  809.                8 x-pixels wide and from 8 to 16 y-pixels high.
  810.  
  811.                GCursor and GUCursor maintain the simulated cursor while
  812.                the keyboard type-ahead buffer is empty.  GCursor shape
  813.                is an underscore when INSERT is off and a larger block
  814.                when INSERT is on.  GUCursor is an underscore regardless
  815.                of the state of the INSERT toggle.
  816. Returns:       nothing
  817. Uses:          EAX, ECX
  818. Supports:      all ASM32 graphics modes
  819. Example:
  820.  
  821. include codeseg.inc
  822.  
  823. extrn   gcursor:near, getkey:near
  824.  
  825. ; data
  826. x       dw 10,20        ; put the cursor in the character block at (10,20)
  827.  
  828. ; code
  829.         .
  830.         .
  831.         .
  832.         lea   edx,x
  833.         call  gcursor
  834.         call  getkey    ; retrieve the key that was pressed
  835.  
  836.  
  837. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  838.  
  839. GETBITBLOCK:   saves a portion of a graphics screen in memory
  840. Source:        bitblock.asm ($graph.asm, bb02.asm, bb04.asm, bb06.asm,
  841.                              bb08.asm, bb10.asm, bb12.asm, bb14.asm)
  842.  
  843. Call with:     ES:[EDI] pointing to memory buffer for the bit block
  844.                DS:[EBX] pointing to x & y coordinate data
  845.  
  846.                Note that a bit block copied from a 4-plane mode may
  847.                only be restored to a 4-plane mode; likewise, a bit
  848.                block saved from a 2-color mode should be restored to
  849.                a 2-color mode or to a single bit plane of a 16-color
  850.                mode.
  851. Returns:       nothing
  852. Uses:          nothing
  853. Supports:      all ASM32 graphics modes
  854.  
  855.  
  856.     If you do not intend to support all ASM32 graphics modes, you can
  857.     call mode-specific BitBlock subroutines to reduce .EXE size.
  858.     These subroutines use the same calling parameters as GetBitBlock
  859.     and PutBitBlock:
  860.  
  861.  
  862.     getbb02: mode 04h, 05h, 11h, 40h, HGraph (mono and InColor)
  863.     getbb06: mode 0Dh, 0Eh, 0Fh, 10h, 12h, SVGA16(0), XMODE16
  864.     getbb08: mode 13h
  865.     getbb10: VGA13X
  866.     getbb12: SVGA16
  867.     getbb14: SVGA256
  868.  
  869.  
  870.     putbb02: mode 04h, 05h, 11h, 40h, HGraph (mono only)
  871.     putbb04: HGraph (InColor only)
  872.     putbb06: mode 0Dh, 0Eh, 0Fh, 10h, 12h, SVGA16(0), XMODE16
  873.     putbb08: mode 13h
  874.     putbb10: VGA13X
  875.     putbb12: SVGA16
  876.     putbb14: SVGA256
  877.  
  878. Example on next page
  879.  
  880.  
  881. ; example of GetBitBlock use
  882.  
  883. include model.inc
  884.  
  885. extrn   bitblockbytes:near, getbitblock:near, putbitblock:near
  886.  
  887. include dataseg.inc
  888. ptr     dw ?                ; use this to save pointer to bit block
  889. x0      dw 100,43,175,143   ; save from (100,43) to (175,143)
  890. @curseg ends
  891.  
  892. include codeseg.inc
  893.         .
  894.         .
  895.         lea   ebx,x0        ; point to block corners
  896.         call  bitblockbytes ; calculate byte requirement
  897.         jc    too_big       ; error control
  898.         mov   ebx,eax
  899.         sys   GetMemNear
  900.         jc    no_memory     ; more error control
  901.         mov   ptr,ebx       ; save near address of bit block
  902.         mov   edi,ebx       ; EDI points to buffer
  903.         push  ds
  904.         pop   es
  905.         lea   ebx,x0        ; EBX points to coordinate data
  906.         call  getbitblock
  907.         .
  908.         .
  909.  
  910. ; later . . .
  911.         lea   ebx,x0        ; put the bit block back where you found it
  912.         mov   edi,ptr       ; EDI points to buffer
  913.         push  ds
  914.         pop   es
  915.         call  putbitblock
  916.  
  917.  
  918. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  919.  
  920. GETBITPLANE:   saves one plane of a bit block in memory
  921. Source:        small & medium: bitplane.asm ($graph.asm, bb02.asm, bb04.asm
  922.                                bb06.asm, bb08.asm, bb10.asm, bb12.asm,
  923.                                bb14.asm)
  924.  
  925. Call with:     ES:[EDI] pointing to memory buffer for the bit block
  926.                DS:[EBX] pointing to x & y coordinate data
  927.                AL = plane number to save
  928.                valid plane numbers are 0 - 3 in 16-color modes
  929.                                        0 & 2 in EGA monochrome mode
  930.  
  931.                In 16-color modes, EGA/VGA and InColor planes are:
  932.                 0 = blue, 1 = green, 2 = red, 3 = gray (or intensity)
  933.                In EGA monochrome mode, plane 0 = normal, plane 2 = blink
  934.                 or intensity
  935.                The actual colors each plane represents may change
  936.                depending on the values in the pallete registers.
  937.  
  938. Supports:      all 16-color modes plus EGA monochrome
  939.                other modes: GetBitPlane works like GetBitBlock
  940.  
  941.  
  942. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  943.  
  944. GETVIEW:       returns a pointer to the current view coordinates for
  945.                the active page
  946. Source:        getview.asm ($graph.asm)
  947.  
  948. Call with:     no parameters
  949.                most ASM32 subroutines, except the GPrint series, Gload,
  950.                GCopy and GSave, limit their activity to the view region.
  951.                You may use the returned pointer to change the active
  952.                portion of the screen; be careful not to exceed the maximum
  953.                x1 and y1 values permitted by the current mode.  Also, x0
  954.                must always be less than x1 and y0 must always be less than
  955.                y1.
  956.                ASM32's defaults are:
  957.                 x0 = 0
  958.                 y0 = 0
  959.                 x1 = xmax
  960.                 y1 = ymax
  961.  
  962.                See also ResetView
  963.  
  964. Returns:       EBX pointing to the current view coordinates
  965. Uses:          EBX
  966. Supports:      all ASM32 graphics modes and pages
  967. Example:
  968.  
  969. include codeseg.inc
  970.  
  971. extrn   getview:near
  972.  
  973. x0 EQU word ptr [EBX]
  974. y0 EQU word ptr 2[EBX]
  975. x1 EQU word ptr 4[EBX]
  976. y1 EQU word ptr 6[EBX]
  977.  
  978. ; code
  979.         .
  980.         .
  981.         .
  982.         call   getview
  983.  
  984.  
  985. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  986.  
  987. GETDOT:        determine pixel value on graphics screen
  988. Source:        getdot.asm ($graph.asm, $getdot.asm, others)
  989.  
  990. Call with:     EBX pointing to pixel coordinate data
  991. Returns:       if CF = 0, AX = pixel value
  992.                if CF = 1, pixel coordinates outside active view area
  993. Uses:          EAX, CF
  994. Supports:      all ASM32 graphics modes
  995. Example:
  996.  
  997. include codeseg.inc
  998.  
  999. extrn   getdot:near
  1000.  
  1001. ; data
  1002. x       dw 10,10             ; pixel at (10,10)
  1003.  
  1004. ; code
  1005.         .
  1006.         .
  1007.         .
  1008.         lea    ebx,x         ; point to pixel coordinates
  1009.         call   getdot        ; get pixel value
  1010.         jc     out_of_bounds ; oops
  1011.  
  1012.  
  1013.  
  1014. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1015.  
  1016. GLOAD:         loads a graphics screen saved as a disk file by GSave
  1017. Source:        gload.asm ($graph.asm, $gbytes.asm, $reset.asm, $plane.asm)
  1018.  
  1019. Call with:     EDX pointing to the name of the file to load
  1020.                the filename must be an ASCIIZ string in low memory
  1021. Returns:       AX = MS-DOS error code
  1022. Uses:          EAX, flags
  1023. Supports:      all ASM32 graphics modes
  1024. Example:
  1025.  
  1026. include codeseg.inc
  1027.  
  1028. extrn   gload:near
  1029.  
  1030. ; data
  1031. filename db 'graph.bin',0
  1032.  
  1033. ; code
  1034.         .
  1035.         .
  1036.         lea   edx,filename
  1037.         call  gload
  1038.  
  1039.  
  1040. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1041.  
  1042. GPAGE:         changes active and displayed graphics page
  1043.                GPage changes ASM32's default graphics page and displays
  1044.                the page.  See also UseGPage and ShowGPage.
  1045. Source:        gpage1.asm ($graph.asm, $herc.asm, gpage.asm)
  1046.  
  1047. Call with:     BL = page number.  See table at start of this GRAPHICS.DOC
  1048.                file.
  1049. Returns:       if CF = 0, no problem
  1050.                if CF = 1, bad page number requested
  1051. Uses:          CF
  1052. Supports:      EGA, VGA, Hercules, InColor: modes with more than one page
  1053. Example:
  1054.  
  1055. include codeseg.inc
  1056.  
  1057. extrn   gpage:near
  1058.  
  1059. ; code
  1060.         .
  1061.         .
  1062.         mov    bl,1          ; use and show page 1
  1063.         call   gpage
  1064.         jc     oops          ; uh oh, wrong mode
  1065.  
  1066. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1067.  
  1068. GPRINT:        prints ASCIIZ string on a graphics screen
  1069. Source:        gprint.asm ($graph.asm, f8x14.asm, $gp00.asm, $gp02.asm,
  1070.                            $gp06.asm, $gp08.asm, $gp10.asm, others)
  1071.  
  1072. Call with:     ESI pointing to the ASCIIZ string
  1073.                EDX pointing to x- and y-coordinate data
  1074.                drawmodes supported by GPrint are:
  1075.                 2 = foreground only; background pixels left alone
  1076.                 1 = foreground and background pixels updated with
  1077.                     current gcolor
  1078.                 0 = foreground color is XORed with the existing screen
  1079.                -1 = like drawmode 1, but foreground and background reversed
  1080.                -2 = like drawmode 2, but uses background color
  1081.                Any pixel position may be specified; does not wrap around
  1082.                from right side of screen to left.  Default character size
  1083.                is 8x8 for CGA modes and modes 0Dh, 0Eh and 13h, 8x14 for
  1084.                others.
  1085.                High ASCII characters are undefined in 8x8 pixel modes
  1086.                unless you call SmallText sometime earlier in the program.
  1087. Returns:       nothing
  1088. Uses:          ECX; all other registers and flags are saved
  1089. Supports:      all ASM32 graphics modes
  1090.                not all drawmodes supported with CGA modes 04h and 05h
  1091. Example:
  1092.  
  1093. include codeseg.inc
  1094.  
  1095. extrn   gprint:near
  1096.  
  1097. ; data
  1098. string  db 'print this, if you will',0
  1099. gpos    dw 0,0                          ; print at upper left corner
  1100.  
  1101. ; code
  1102.         .
  1103.         .
  1104.         .
  1105.         lea   esi,string
  1106.         lea   edx,gpos
  1107.         call  gprint
  1108.  
  1109. additional GPRINT information on next page
  1110.  
  1111. GPRINT will work with user-defined fonts up to 16 pixel rows high in all
  1112. modes with ymax > 200.  GPRINT reads a public data area in DGROUP to
  1113. determine the SEGMENT:OFFSET address of the font data, the number of pixel
  1114. rows per character and the byte increment between sucessive character
  1115. definitions.  Characters must be 8 pixels wide.
  1116.  
  1117. FONTDATA.ASM has the required font data:
  1118.  
  1119. public  f14seg
  1120. f14seg  dd OFFSET f8x14 ; offset of user-loaded font (8x14 default)
  1121.         db 14           ; byte size of character
  1122.         db 14           ; bytes from start of one char to start of next
  1123.  
  1124. Example:
  1125.  
  1126. include model.inc
  1127.  
  1128. extrn   $fopen:near, $fread:near
  1129.  
  1130. include dataseg.inc
  1131.  
  1132. ; data
  1133. extrn   f14seg:dword
  1134.  
  1135. fname   db 'c:\ramfont\italics.fnt',0   ; 8x14 characters
  1136. fbuffer db 4096 dup (0)                 ; all RAMFont fonts are 4096 bytes
  1137. ; the fonts supplied by Hercules with the Graphics Card Plus and InColor
  1138. ; card are a variety of sizes, but in each font file the byte increment
  1139. ; is always 16 bytes
  1140.  
  1141. @curseg   ends
  1142.  
  1143. include codeseg.inc
  1144.  
  1145. ; code
  1146.         .
  1147.         .
  1148.         lea     edx,fname       ; filename is in low memory
  1149.         call    fopen          ; open file for read
  1150.         mov     bx,ax           ; copy file handle to BX
  1151.         lea     edx,fbuffer     ; EDX points to buffer
  1152.         mov     cx,4096
  1153.         call    fread
  1154.         call    fclose         ; close file
  1155.         mov     f14seg,edx      ; update address of new font
  1156.         mov     f14seg+4,(16 shl 8) OR 14
  1157.                                 ; 14-pixel row character
  1158.                                 ; 16 bytes between character definitions
  1159.  
  1160. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1161.  
  1162. GPRINTDOWN:    prints ASCIIZ string vertically on graph screen
  1163. GPRINTUP:      prints ASCIIZ string vertically on graph screen
  1164. Source:        gprint.asm ($graph.asm, f8x14.asm, $gp00.asm, $gp02.asm,
  1165.                            $gp06.asm, $gp08.asm, $gp10.asm, others)
  1166.  
  1167. Call with:     same as GPrint
  1168.                rotates each character 90 degrees and prints from top
  1169.                downward or from bottom upward.  Character size 8x8.
  1170.  
  1171.                Returned data and registers used same as GPrint
  1172. Example:       see GPrint.
  1173.  
  1174.  
  1175. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1176.  
  1177. GPRINTX:       print string on a graphics screen, double width
  1178. GPRINT2X:      print string on a graphics screen, double size
  1179. GPRINTDOWNX:   print string vertically on graph screen, 2x width
  1180. GPRINTDOWN2X:  print string vertically on graph screen, 2x size
  1181. GPRINTUPX:     print string vertically on graph screen, 2x width
  1182. GPRINTUP2X:    print string vertically on graph screen, 2x size
  1183. Source:        gprintx.asm ($graph.asm, f8x14.asm, $gp00.asm, $gp02.asm,
  1184.                             $gp06.asm, $gp08.asm, $gp10.asm, others)
  1185.  
  1186.  
  1187.                Variations of GPrint and GPrintDOWN/GPrintUP;
  1188.                GPrintx, GPrintDOWNx and GPrintUPx print characters
  1189.                which are twice as wide as normal; 2x subroutines
  1190.                print the characters twice as wide and twice as high
  1191.                as normal.
  1192.  
  1193.                Parameters, supported modes and drawmodes are same as
  1194.                GPrint.  GPrintx and GPrint2x also work with user-defined
  1195.                fonts.  See GPrint.
  1196. Example:       see GPrint.
  1197.  
  1198.  
  1199. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1200.  
  1201. GPUTCHR:       print a single character on graphics screen
  1202. Source:        gputchr.asm (gprint.asm)
  1203.  
  1204. Call with:     EDX pointing to (x,y) coordinate data
  1205.                AL = character to print
  1206. Returns:       nothing
  1207. Uses:          ECX
  1208. Supports:      all ASM32 graphics modes
  1209. Example:
  1210.  
  1211. include codeseg.inc
  1212.  
  1213. public  mycode
  1214. extrn   gputchr:near
  1215.  
  1216. ; data
  1217. xy      dw 10,10        ; (x,y) coordinates for character
  1218.  
  1219. ; code
  1220. mycode  proc
  1221. ; program fragment assumes screen in graphics mode
  1222.         .
  1223.         .
  1224.         .
  1225.         lea     edx,xy   ; EDX points to coordinate data
  1226.         mov     al,'A'
  1227.         call    gputchr
  1228.         .
  1229.         .
  1230.         .
  1231.         ret
  1232. mycode  endp
  1233.         end
  1234.  
  1235.  
  1236.  
  1237. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1238.  
  1239. GSAVE:         saves a graphics screen as a disk file
  1240.                does not compress image
  1241. Source:        gsave.asm ($graph.asm, $gbytes.asm, $reset.asm, $plane.asm)
  1242.  
  1243. Call with:     EDX pointing to ASCIIZ filename in low memory
  1244.                disk space requirements vary depending on graphics mode:
  1245.  
  1246.                  HGraph  (mono)       32,768 bytes
  1247.                  HGraph  (InColor)   131,072 bytes
  1248.                  VGA13X(0)            64,000 bytes
  1249.                  VGA13X(1)            76,800 bytes
  1250.                  VGA13X(2)           128,000 bytes
  1251.                  VGA13X(3)           172,800 bytes
  1252.                  XMode16  varies; up to 240,000 bytes
  1253.                  VESA6Ah, SVGA16(0)  240,000 bytes
  1254.                  SVGA16(1)           393,216 bytes
  1255.                  SVGA256(0)          256,000 bytes
  1256.                  SVGA256(1)          307,200 bytes
  1257.                  SVGA256(2)          480,000 bytes
  1258.                  SVGA256(3)          786,432 bytes
  1259.                  04h/05h/06h          16,384 bytes
  1260.                  40h                  32,768 bytes
  1261.                  0Dh                  32,000 bytes
  1262.                  0Eh                  64,000 bytes
  1263.                  0Fh                  56,000 bytes
  1264.                  10h                 112,000 bytes
  1265.                  11h                  38,400 bytes
  1266.                  12h                 153,600 bytes
  1267.                  13h                  64,000 bytes
  1268.  
  1269. Returns:       if CF = 1, AX = MS-DOS error code
  1270.                if CF = 0, no error
  1271. Uses:          AX, flags
  1272. Supports:      all ASM32 graphics modes
  1273. Example:
  1274.  
  1275. include codeseg.inc
  1276.  
  1277. extrn   gsave:near
  1278.  
  1279. ; data
  1280. filename db 'graph.bin',0
  1281.  
  1282. ; code
  1283.         .
  1284.         .
  1285.         .
  1286.         lea   edx,filename        ; point to ASCIIZ filename
  1287.         call  gsave               ; save graph
  1288.         jc    oops                ; do some error control if problem
  1289.  
  1290. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1291.  
  1292. LINEPATTERN:   defines an optional pattern for DrawLine and DrawBox
  1293. Source:        lpattern.asm ($graph.asm)
  1294.  
  1295. Call with:     EBX pointing to an ASCIIZ string of up to 8 characters.
  1296.                The bit patterns in each character are used to make dashed
  1297.                or dotted lines. For drawmodes > 0, each pixel in the line
  1298.                is updated with the foreground color if the corresponding
  1299.                bit in the bit pattern is 1.  If the bit in the bit pattern
  1300.                is 0, the corresponding pixel in the line is treated as a
  1301.                background pixel.  LinePattern must be called before each
  1302.                call to a subroutine in drawline.obj if you want the line
  1303.                pattern to be used.
  1304.  
  1305.                drawmodes supported are:
  1306.                (monochrome modes)
  1307.                 2 = update foreground pixels only
  1308.                 1 = update foreground and background pixels
  1309.                 0 = XOR the foreground color with the existing image
  1310.                -1 = like drawmode 1, but foreground and background colors
  1311.                     are reversed
  1312.                -2 = like drawmode 2, but foreground and background colors
  1313.                     are reversed
  1314.                (color modes)
  1315.                same as monochrome, plus:
  1316.                 3 = OR the foreground pixels with the pre-existing screen
  1317.                -3 = OR the background pixels with the pre-existing screen
  1318.                 4 = AND the foreground pixels with the pre-existing screen
  1319.                -4 = AND the background pixels with the pre-existing screen
  1320.  
  1321. Returns:       nothing
  1322. Uses:          nothing
  1323. Supports:      all ASM32 graphics modes
  1324. Example:
  1325.  
  1326. include codeseg.inc
  1327.  
  1328. extrn   linepattern:near, drawline:near
  1329.  
  1330. ; data
  1331. x0      dw 25,10,301,97          ; line endpoints at (25,10) & (301,97)
  1332. pattern db 4 dup(32,64),0        ; 8 bytes past x0
  1333.  
  1334. ; code
  1335.         .
  1336.         .
  1337.         lea   ebx,pattern        ; EBX points to bit pattern
  1338.         call  linepattern        ; let drawline know what pattern to use
  1339.         sub   ebx,8              ; point to line endpoint data
  1340.         call  drawline           ; draw a patterned line
  1341.  
  1342. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1343.  
  1344. LOADPCX:       reads a .PCX-format file from disk and unpacks to screen
  1345. Source:        loadpcx.asm ($graph.asm, color16.asm, fopen.asm, fseek.asm,
  1346.                             fget.asm, fgetchr.asm, $plane.asm, $reset.asm)
  1347.  
  1348. Call with:     [EDX] pointing to ASCIIZ filename of .PCX file.
  1349.                LoadPCX assumes that the video system is in an appropriate
  1350.                mode for the image; see PCXInfo (GRAPHICS.DOC).
  1351.                The dimensions of the image in the .PCX file need not
  1352.                match the screen dimensions exactly; any 16-color image
  1353.                may be loaded to a 16-color screen; if the image is too
  1354.                large for the video buffer, either the upper left portion
  1355.                of the image is unpacked, or you may re-size the video buffer
  1356.                (see BufferDim) to fit the image.  Any 2-color ("monochrome")
  1357.                image may be loaded to any monochrome screen.
  1358.  
  1359.                256-color PCX files intended for the standard 320x200
  1360.                mode 13h may be loaded to the non-standard VGA13X modes.
  1361.                In VGA13X modes with 400 or 480 vertical pixel rows,
  1362.                a 320x200 image is stretched to fit screen proportions.
  1363. Returns:       if CF = 0, no error
  1364.                if CF = 1, AX = DOS error code
  1365. Uses:          AX, flags
  1366. Supports:      All ASM32 graphics modes EXCEPT:
  1367.                   InColor (palette not working right)
  1368.                   mode 04h, 05h (no palette)
  1369.                   mode 0Fh (EGA monochrome)
  1370. Example:       see PCXInfo and BufferDim         
  1371.                
  1372.  
  1373.  
  1374. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1375.  
  1376. PUTBITBLOCK:   restores bit block saved by GetBitBlock
  1377. PUTBITPLANE:   restores bit plane saved by GetBitPlane
  1378. Source:        same as GetBitBlock or GetBitPlane
  1379.  
  1380. Call with:     DS:[EBX] pointing to upper left corner coordinates
  1381.                ES:[EDI] pointing to buffer with stored bit block
  1382.                 PutBitPlane: AL = plane number
  1383.                 valid plane numbers for 16-color modes are 0 - 3
  1384.                                     for EGA mode 11h       0 & 2
  1385.  
  1386.                Drawmodes supported are:
  1387.                 mode 13h, VGA13x, SVGA256:
  1388.                  1 = replace existing screen area with bit block
  1389.                  2 = replace existing screen with non-zero pixels
  1390.                      in bit block
  1391.  
  1392.                 HGraph (InColor):
  1393.                  4 = AND the bit block with the existing screen
  1394.                  3 = OR the bit block with the existing screen
  1395.                  1,2 = replace existing screen area with bit block
  1396.                  0 = XOR the bit block with the existing image
  1397.                 -1,-2 = replace existing screen area with inverse bit block
  1398.  
  1399.                 16-color EGA/VGA-type modes and mode 0Fh:
  1400.                  same as InColor, plus:
  1401.                 -3 = OR the inverse bit block with the existing screen
  1402.                 -4 = AND the inverse bit block with the existing screen
  1403.  
  1404.                 mode 04h, 05h, 06h, 40h, HGraph (mono), 11h:
  1405.                  4, 1, 0, -1 same as InColor
  1406.                  2, 3 = combine non-zero pixels in the bit block with the
  1407.                         pre-existing image
  1408.                 -2 = combine non-zero pixel in the inverse bit block with
  1409.                      the pre-existing screen image
  1410.  
  1411.                Most PutBitBlock code ignores View limits (see GetView)
  1412.                but BB08.ASM, BB10.ASM and BB14.ASM (for 256-color modes)
  1413.                clip PutBitBlock operations at View boundaries.
  1414.  
  1415. Returns:       nothing
  1416. Uses:          nothing
  1417. Supports:      all ASM32 graphics modes
  1418. Example:       see GetBitBlock
  1419.  
  1420.  
  1421. bit block formats explained on following pages
  1422.  
  1423.  
  1424. ; BIT BLOCK FORMATS
  1425.  
  1426. ; mode 04h, 05h, 06h Hercules monochrome, 11h, and bit planes
  1427. ;
  1428. ; the first word in the buffer is the number of pixel rows (vertical)
  1429. ; in the bit block; the second word is the number of bytes per screen row;
  1430. ; the fifth byte is a bit mask for the last byte of each pixel row.
  1431. ; The bit mask = 0FFh for byte-aligned bit blocks.
  1432.  
  1433. bblock  dw 15,5              ; 15 rows, 5 bytes per row
  1434.         db 11111110b         ; bit mask for right end of pixel row
  1435.                              ; bit block data follows:
  1436.                              ;  15 rows, 5 bytes per row
  1437.         db 00000000b,10000000b,00000000b,10000000b,00000010b
  1438.         db 00000001b,11000000b,00000001b,11000000b,00000110b
  1439.         db 00000011b,11100000b,00000011b,11100000b,00001100b
  1440.         db 00000111b,01110000b,00000111b,01110000b,00011000b
  1441.         db 00001110b,00111000b,00001110b,00111000b,00110000b
  1442.         db 00011100b,00011100b,00011100b,00011100b,01100000b
  1443.         db 00000001b,11000000b,00000001b,11000000b,11000000b
  1444.         db 00000001b,11000000b,00000001b,11000000b,01100000b
  1445.         db 00000001b,11000000b,00000001b,11000000b,00110000b
  1446.         db 00000001b,11000000b,00000001b,11000000b,00011000b
  1447.         db 00000001b,11000000b,00000001b,11000000b,00001100b
  1448.         db 00000001b,11000000b,00000001b,11000000b,00000110b
  1449.         db 00000001b,11000000b,00000001b,11000000b,00000010b
  1450.         db 00000001b,11000000b,00000001b,11000000b,00000000b
  1451.         db 00000001b,11000000b,00000001b,11000000b,00000000b
  1452.  
  1453. ; 16-color modes: 0Dh, 0Eh, 10h, 12h, 6Ah, xmode16, InColor:
  1454. ; same as above, except there are 4 planes of bit block data
  1455. ; i. e., 4 groups of 15-row, 5-byte data; plane 3 is the first
  1456. ; block, followed by planes 2, 1, and 0.
  1457.  
  1458. ; EGA monochrome mode: 0Fh
  1459. ; similar to 16-color modes, but there are only 2 groups of bit
  1460. ; block data instead of 4
  1461.  
  1462.  
  1463. ; 256-color modes on next page
  1464.  
  1465.  
  1466. ; BIT BLOCK FORMATS
  1467.  
  1468. ; All 256-color modes: no bit mask in the bit block header
  1469.  
  1470. red     equ 12                    ; bright red
  1471. blue    equ 1                     ; blue
  1472.  
  1473. bblock  dw 12,5                   ; 12 rows, 5 bytes per row
  1474.         db red, red, blue,red, red
  1475.         db red, blue,red, blue,red
  1476.         db blue,red, red, red, blue
  1477.         db red, red, blue,red, red
  1478.         db red, blue,red, blue,red
  1479.         db blue,red, red, red, blue
  1480.         db red, red, blue,red, red
  1481.         db red, blue,red, blue,red
  1482.         db blue,red, red, red, blue
  1483.         db red, red, blue,red, red
  1484.         db red, blue,red, blue,red
  1485.         db blue,red, red, red, blue
  1486.  
  1487.  
  1488.  
  1489. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1490.  
  1491. PUTDOT:        change a pixel on a graphics screen
  1492. Source:        putdot.asm ($graph.asm, $putdot.asm, others)
  1493.  
  1494. Call with:     EBX pointing to x & y coordinates
  1495.                Drawmodes supported are:
  1496.                (monochrome)
  1497.                 1 = set pixel
  1498.                 0 = toggle pixel
  1499.                -1 = erase pixel
  1500.  
  1501.                (color modes)
  1502.                 3 = OR foreground color with pre-existing pixel
  1503.                 1, 2 = replace pixel with foreground color
  1504.                 0 = XOR foreground color with pre-existing pixel
  1505.                -1, -2 = replace pixel with background color
  1506.                -3 = OR background color with pre-existing pixel
  1507. Returns:       if CF = 0, no error
  1508.                if CF = 1, pixel coordinates outside active view area
  1509. Uses:          CF; all other registers and flags are saved
  1510. Supports:      all ASM32 graphics modes
  1511. Example:
  1512.  
  1513. include codeseg.inc
  1514.  
  1515. extrn   putdot:near
  1516.  
  1517. ; data
  1518. extrn   drawmode:byte
  1519. x       dw 100,117            ; pixel at x = 100, y = 117
  1520.  
  1521. ; code
  1522.         .
  1523.         .
  1524.         .
  1525.         mov   drawmode,1      ; use foreground color
  1526.         lea   ebx,x           ; point to pixel coordinates
  1527.         call  putdot
  1528.  
  1529.  
  1530.  
  1531. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1532.  
  1533. PCXINFO:       read vital information from .PCX-format graphics file
  1534. Source:        pcxinfo.asm
  1535.  
  1536. Call with:     [EDX] pointing to ASCIIZ name of .PCX file
  1537. Returns:       [EBX] pointing to PCX information data structure:
  1538.  
  1539.                pcx_info struc
  1540.                horiz    dw 0
  1541.                vert     dw 0
  1542.                colors   dw 0
  1543.                planes   db 0
  1544.                xpixels  dw 0
  1545.                ypixels  dw 0
  1546.                pcx_info ends
  1547.  
  1548.                horiz and vert are screen dimensions
  1549.                colors: 16 for EGA/VGA 16-color modes, 256 for 256-color modes
  1550.                planes: number of bit planes encoded
  1551.                        4 for 16-color modes, 1 for monochrome, CGA or mode 13h
  1552.                xpixels: horizontal image size
  1553.                ypixels: vertical image size
  1554.  
  1555.  
  1556.  
  1557. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1558.  
  1559. RESETVIEW:     restores default view area on active graphics page and
  1560.                returns a pointer to the view data
  1561. Source:        view.asm ($graph.asm)
  1562.  
  1563. Call with:     no parameters
  1564.                ResetView restores the default full screen view area.
  1565.                The far pointer returned points to ASM32's data area in
  1566.                $graph.obj for the active graphics page's view coordinates.
  1567. Returns:       EBX pointing to the active page's view data.
  1568. Uses:          EBX; all other registers and flags are saved
  1569. Supports:      all ASM32 graphics modes
  1570. Example:
  1571.  
  1572. include codeseg.inc
  1573.  
  1574. extrn   resetview:near
  1575.  
  1576. x0 EQU word ptr [EBX]
  1577. y0 EQU word ptr 2[EBX]
  1578. x1 EQU word ptr 4[EBX]
  1579. y1 EQU word ptr 6[EBX]
  1580.  
  1581. ; code
  1582.         .
  1583.         .
  1584.         .
  1585.         call  resetview
  1586.  
  1587.  
  1588.  
  1589. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1590.  
  1591. SCREENORIGIN:  control position of re-sized video buffer on screen
  1592.                see also BufferDim in GRAPHICS.DOC
  1593. Source:        scrnorig.asm
  1594.  
  1595. Call with:     EBX pointing to upper-left coordinates of logical
  1596.                video buffer to be displayed at upper-left corner of screen.
  1597. Returns:       nothing
  1598. Uses:          nothing
  1599. Supports:      EGA/VGA 16-color modes re-sized with BufferDim
  1600. Example:       see BufferDim
  1601.  
  1602.  
  1603. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1604.  
  1605. SHOWGPAGE:     change graphics page displayed on screen
  1606.                See also UseGPage and GPage.
  1607. Source:        gpage1.asm ($graph.asm, $herc.asm)
  1608.  
  1609. Call with:     BL = page number
  1610. Returns:       Carry Flag = error code
  1611.                if CF = 0, no error
  1612.                if CF = 1, bad page number
  1613. Uses:          CF
  1614. Supports:      HGraph (mono and InColor), modes 0Dh, 0Eh, 0Fh, 10h, VGA13X
  1615. Example:
  1616.  
  1617. include codeseg.inc
  1618.  
  1619. extrn   showgpage:near
  1620.  
  1621. ; code
  1622.         .
  1623.         .
  1624.         .
  1625.         mov   bl,1           ; show page 1
  1626.         call  showgpage
  1627.         jc    no_page_1      ; no page 1 for this mode
  1628.  
  1629. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1630.  
  1631. SHOWGPLANE:    show one or more planes of multi-plane EGA/VGA screen
  1632. Source:        gplane.asm ($graph.asm)
  1633.  
  1634. Call with:     AL = plane mask
  1635.                Bits set in the plane mask correspond to the plane displayed.
  1636.                ASM32's default mask is 00001111b, enabling all 4 planes.
  1637. Returns:       CF = error flag
  1638.                if CF = 0, no error
  1639.                if CF = 1, bad plane mask or graphics mode
  1640. Uses:          CF
  1641. Supports:      EGA & VGA 16-color modes, including VESA 6Ah, xmode16
  1642.                    and SVGA16
  1643.                EGA monochrome: planes 0 and 2
  1644.                    (mask = 00000101b for both planes)
  1645.                Hercules InColor
  1646. Example:
  1647.  
  1648. include codeseg.inc
  1649.  
  1650. extrn   showgplane:near
  1651.  
  1652. ; code
  1653.         .
  1654.         .
  1655.         .
  1656.         mov   al,00000101b      ; show planes 0 and 2
  1657.         call  showgplane
  1658.         jc    error             ; error control
  1659.  
  1660.  
  1661.  
  1662. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1663.  
  1664. SMALLTEXT:     change GPrint, GPrintX and GPrint2X default to 8x8 characters
  1665.                in Hercules and modes 10h, 11h, 12h; makes 8x8-size
  1666.                high ASCII characters available to GPrint in all modes
  1667. Source:        smalltxt.asm (f8x8.asm, $graph.asm)
  1668.  
  1669. STDTEXT:       restore GPrint default characters (see GPrint)
  1670. Source:        stdtext.asm (f8x14.asm, fontdata.asm)
  1671.  
  1672. Call with:     no parameters
  1673. Returns:       nothing
  1674. Uses:          nothing; all registers and flags are saved
  1675. Example:
  1676.  
  1677. include codeseg.inc
  1678.  
  1679. extrn   smalltext:near, stdtext:near
  1680.  
  1681. ; code
  1682.         .
  1683.         .
  1684.         .
  1685. ; make GPrint use the small 8x8 characters
  1686. ; make sure high ASCII characters are available
  1687.         call   smalltext
  1688.         .
  1689.         .
  1690.  
  1691. ; sometime later, I want to use larger 8x14 characters
  1692.         call   stdtext
  1693.  
  1694.  
  1695. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1696.  
  1697. UC2SYS:        convert user-defined coordinates to system coordinates
  1698. Source:        uc2sys.asm ($graph.asm)
  1699.  
  1700. Call with:     EBX pointing to (x0,y0,x1,y1) coordinates in
  1701.                user-defined coordinates
  1702. Returns:       EBX pointing to (x0,y0,x1,y1) coordinates in system
  1703.                coordinates
  1704.                UCINIT and UC2SYS allow the programmer to define a
  1705.                graph coordinate system to fit the data, and converts
  1706.                the system's y-orientation from top-to-bottom to the more
  1707.                familiar bottom-to-top
  1708.                US2SYS maintains a separate data area for converted
  1709.                coordinates; the input coordinates are not changed
  1710. Uses:          BX
  1711. Supports:      all ASM32 graphics modes; user-defined coordinates
  1712.                from -32767 to +32767; see also UCINIT
  1713. Example:       see UCINIT
  1714.  
  1715.  
  1716. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1717.  
  1718. UCINIT:        specify user-defined coordinates
  1719. Source:        uc2sys.asm ($graph.asm)
  1720.  
  1721. Call with:     EBX pointing to desired xmin, ymin, xmax, ymax
  1722.                coordinates (xmax-xmin < 32767, ymax-ymin < 32767)
  1723.                ASM32's default user coordinates are (0,0,1000,1000)
  1724. Returns:       nothing
  1725. Uses:          nothing
  1726. Example:
  1727.  
  1728. include codeseg.inc
  1729.  
  1730. ; I'm plotting a graph on the screen with x-axis data from 1983 to 2007
  1731. ; and y-axis data from -72 to 140
  1732. ; I'll leave some space on each side for titles, etc.
  1733.  
  1734. extrn   ucinit:near, uc2sys:near
  1735. extrn   drawbox:near
  1736.  
  1737. ; data
  1738. x0      dw 1975    ; xmin
  1739. y0      dw -80     ; ymin
  1740. x1      dw 2014    ; xmax
  1741. y1      dw 148     ; ymax
  1742.  
  1743. ; code
  1744.         .
  1745.         .
  1746.         .
  1747. ; establish coordinates
  1748.         lea     ebx,x0
  1749.         call    ucinit
  1750.  
  1751. ; draw a box around the graph
  1752.         mov     x0,1983
  1753.         mov     y0,-72
  1754.         mov     x1,2007
  1755.         mov     y1,140
  1756.         lea     ebx,x0
  1757.         call    uc2sys
  1758.         call    drawbox
  1759.  
  1760. ; SEE ALSO BARGRAPH.ASM EXAMPLE PROGRAM
  1761.  
  1762.  
  1763. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1764.  
  1765. USEGPAGE:      changes active graphics page used by ASM32
  1766.                does not change page displayed (see GPage and ShowGPage)
  1767. Source:        gpage.asm ($graph.asm, $herc.asm)
  1768.  
  1769. Call with:     BL = page number
  1770. Returns:       if CF = 0, no error
  1771.                if CF = 1, bad page number
  1772. Uses:          CF
  1773. Supports:      HGraph (mono and InColor) with Use64k
  1774.                EGA and VGA: modes with more than one page
  1775. Example:
  1776.  
  1777. include codeseg.inc
  1778.  
  1779. extrn   usegpage:near
  1780.  
  1781. ; code
  1782.         .
  1783.         .
  1784.         mov   bl,1
  1785.         call  usegpage
  1786.         jc    oops
  1787.  
  1788.  
  1789.  
  1790. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1791.  
  1792. VIEWLIMIT:     determine current mode's maximum dimensions
  1793. Source:        view.asm ($graph.asm)
  1794.  
  1795. Call with:     no parameters
  1796. Returns:       EBX pointing to xmax
  1797.                EBX+2 pointing to ymax
  1798. Uses:          EBX
  1799. Supports:      all ASM32 graphics modes
  1800. Example:
  1801.  
  1802. include codeseg.inc
  1803.  
  1804. extrn   viewlimit:near
  1805.  
  1806. ; code
  1807.         .
  1808.         .
  1809.         call  viewlimit
  1810.  
  1811.